// https://leetcode-cn.com/problems/palindromic-substrings/
// 647. Palindromic Substrings
export function countSubstrings(s: string): number {
    const n = s.length;
    let result = 0;
    for (let i = 0; i < 2 * n - 1; i++) {
        let l = i / 2;
        let r = i / 2 + (i % 2);
        while (l >= 0 && r < n && s.charAt(l) === s.charAt(r)) {
            l--;
            r++;
            result++;
        }
    }
    return result;
}
